﻿@{
    Layout = null;
}

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
    <meta name="author" content="ARC Dev [www.anruichina.com]" />
    <meta name="description" content="Smart Event Management" />
    <meta name="keywords" content="云,ARC Dev,安锐卓越" />
    <title>通用管理后台</title>
    <link rel="shortcut icon" href='@Url.Content("~/favicon.ico")'>
    <link rel="stylesheet" href='@Url.Content("~/lib/Layui/css/layui.css?v=201809251")' type="text/css" />
    <link rel="stylesheet" href='@Url.Content("~/lib/Layui/css/layui.mobile.css?v=20180925")' type="text/css" />
    <link href='@Url.Content("~/css/Account/login.css?v=2018121800315")' rel="stylesheet" />
    <script src="~/lib/jquery/dist/jquery.js"></script>
    <script type="text/javascript" src="~/lib/Layui/layui.js?20180928"></script>
    <script type="text/javascript" src="~/lib/Layui/layui.all.js?v=20180925"></script>

</head>

<body class="login-bg">

    <div class="login">
        <div class="message">通用管理后台</div>
        <div id="darkbannerwrap"></div>
        <form class="layui-form f0">
            <input name="Account" id="Account" placeholder="请输入邮箱/手机号码" type="text" lay-verify="required"
                   class="layui-input">
            <hr class="hr15">
            <input name="Password" id="Password" lay-verify="required" placeholder="请输入密码" type="password"
                   class="layui-input">
            <hr class="hr20">
            <hr class="hr15">
            <input class="loginin" value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        </form>
    </div>
    <script type="text/javascript">
        var UrlBase= '@Url.Content("~/")';
        $('.layui-form').hide();
        $('.layui-form').eq(0).show();

        $('.tabSwitch div').click(function () {
            let i = $(this).data('i');

            $(this).siblings().each((i, item) => {
                $(item).removeClass('selected');
                $(this).addClass('selected');
            })
            $('.layui-form').hide();
            $('.layui-form').eq(i).show();
        })

        // 普通登录
        layui.use(['form', 'layer'], function () {
            var $ = layui.jquery, form = layui.form, layer = layui.layer;
            // 验证
            form.verify({
                Account: function (value) {
                    if (value == "") {
                        return "请输入邮箱/手机号码";
                    }
                },
                Password: function (value) {
                    if (value == "") {
                        return "请输入密码";
                    }
                }

            });
            // 提交监听
            form.on('submit(login)', function (data) {

                data.field.ReturnUrl='@ViewBag.ReturnUrl';
                $.post('@Url.Content("~/Account/SignLogin")'
                    , data.field
                    , function (data) {
                        if (data.errCode != '200') {
                            layer.msg(data.errMsg);
                            return false;
                        }
                        else {
                            window.location.href = data.errMsg;
                        }
                    });

                return false;
            })
        })
        
    </script>
</body>
</html>